package io.renren.modules.subject.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import io.renren.modules.meta.entity.EventEntity;
import io.renren.modules.subject.dao.CriminalStrikePersonsDao;
import io.renren.modules.subject.entity.CriminalStrikePersons;
import io.renren.modules.subject.service.CriminalStrikePersonsService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service("criminalStrikePersonsService")
public class CriminalStrikePersonsServiceImpl extends ServiceImpl<CriminalStrikePersonsDao, CriminalStrikePersons> implements CriminalStrikePersonsService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<CriminalStrikePersons> page = this.page(
                new Query<CriminalStrikePersons>().getPage(params),
                new QueryWrapper<CriminalStrikePersons>()
        );

        return new PageUtils(page);
    }

    @Override
    public List<EventEntity> selectEventsBySubjectId(Long subjectId) {
        return baseMapper.selectEventsBySubjectId(subjectId,"tb_criminal_strike_persons_event");
    }

    @Override
    public int insertSubjectEvent(Long subjectId, Long eventId) {
        return baseMapper.insertSubjectEvent(subjectId,eventId,"tb_criminal_strike_persons_event");
    }

}